package ua.at.tsvetkov.samizdat.data;

import ua.at.tsvetkov.R;

public class BookColor {

	public String					name;
	public int						background;
	public int						textColor;

	public static BookColor[]	colors	= new BookColor[] { new BookColor("Самиздат", R.color.Samizdat, 0xFF393939), new BookColor("Приглушенный", R.color.LightGray, 0xFF393939),
			new BookColor("Стандарт", R.color.White, 0xFF000000), new BookColor("Ночной 1", R.color.Black, 0xFFc9c6aa), new BookColor("Ночной 2", R.color.Black, 0xFF3D8D8D),
			new BookColor("Ночной 3", R.color.Black, 0xFF12B228) };

	public BookColor(String name, String bg, String txt) {
		this.name = name;
		this.background = Integer.valueOf(bg);
		this.textColor = Integer.valueOf(txt);
	}

	public BookColor(String name, int bg, int txt) {
		this.name = name;
		this.background = bg;
		this.textColor = txt;
	}

	public static BookColor getColors(String name) {
		for (int i = 0; i < colors.length; i++) {
			if (colors[i].name.equals(name))
				return colors[i];
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("BookColor [name=");
		builder.append(name);
		builder.append(", background=");
		builder.append(background);
		builder.append(", textColor=");
		builder.append(textColor);
		builder.append("]");
		return builder.toString();
	}

}
